﻿#ifndef ROBOTSERVER_H
#define ROBOTSERVER_H

#include <QObject>
#include <QTcpServer>
#include <QTcpSocket>

class RobotServer : public QObject
{
    Q_OBJECT
public:
    explicit RobotServer(quint16 usPort, QObject *parent = nullptr);
    ~RobotServer();
signals:

private slots:
    void onNewConnection();
    void onSocketReadReady();
    void onSockStateChanged(QAbstractSocket::SocketState s);

protected:
    virtual int parse(unsigned char *buff, qint64 len);

protected:
    QTcpSocket* m_socketCur;
    char* m_buf;
    qint64 m_llRecvBegin;
    qint64 m_llRecvEnd;

private:
    QTcpServer* m_server;
};

#endif // ROBOTSERVER_H
